package com.zhuiyun.project.api.errorCode;

/**
 * @auther zcy
 * @date 2019/10/11 10:40
 */
public enum EmErrorCode implements CommonError {

    //通用的错误类型10001
    PARAMETER_VALIDATION_ERROR(100001, "参数不合法"), //未知错误
    UNKNOW_ERROR(100002, "未知错误"), //新增失败
    SAVE_ERROR(100003, "新增失败"), //删除失败
    DELETE_ERROR(100004, "删除失败"), //修改失败
    UPDATE_ERROR(100005, "修改失败"), //新增失败
    SAVE_OK(100006, "新增成功"), //删除失败
    DELETE_OK(100007, "删除成功"), //修改失败
    UPDATE_OK(100008, "修改成功"),
    ID_NULL(100009, "id不能为空和0"),
    FILE_NOT_EXISTS(100012,"文件不存在或已被清理"),
    IMAGE_NOT_EXISTS(100013,"图片不存在或已被清理"),
    VIDEO_NOT_EXISTS(100014,"视频不存在或已被清理"),
    PROJECT_NAME_ISNULL(100010, "项目名称不能为空"),
    OBJECT_ISNULL(100011, "id不存在，无法删除，请输入正确id进行删除"),
    //20000开头为用户信息相关错误信息
    USER_NOT_EXIST(20001, "用户不存在"), USER_LOGIN_FAIL(20002, "用户手机号不存在或密码不正确"), USER_NOT_LOGIN(20003, "用户还未登录"), USER_NOT_EXPIRE(20004, "登录超时,请重新登录！"), USER_NOT_AUTH(20005, "用户无权访问！"),


    //30000开头为用户信息相关错误信息
    FILE_EMPTY(30001, "附件不能为空"),
    IMAGE_SIZE_ERROR(30002, "图片过大!"),
    FILE_SIZE_ERROR(30003, "附件过大!"),
    VIDEO_SIZE_ERROR(30003, "附件过大!"),
    FILE_TYPE_ERROR(30004, "暂不支持此附件类型"),

    //建表错误
    TABLE_SQL_EMPTY(50001, "后台建表失败，检查设备类型是否正确!"), TABLE_DEVICEtYPE_EMPTY(50002, "设备选择类型不能为空!"),


    //feign 调用接口失败返回异常
    FEIGN_ERROR(70001, "调用远程服务失败"),;

    EmErrorCode(int errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    private int errCode;
    private String errMsg;

    @Override
    public int getErrCode() {
        return this.errCode;
    }

    @Override
    public String getErrMsg() {
        return this.errMsg;
    }

    @Override
    public CommonError setErrorMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
